package com.app.community.service;

import com.app.community.mapper.ResetMapper;
import org.apache.shiro.crypto.hash.SimpleHash;
import org.apache.shiro.util.ByteSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author SakuraA6
 * @Description TODO
 * @Date 2020/10/25 11:09
 **/
@Service
public class ResetService {
    @Autowired
    ResetMapper resetMapper;

    /**
     * 更新用户密码,存储使用MD5加密
     */
    public void resetUser(String userId,String password){
        // password加密
        Object pass = new SimpleHash("MD5", password, ByteSource.Util.bytes(userId),2);

        resetMapper.resetUser(userId,pass.toString());
    }
}
